package com.beyond.controller;

import java.util.HashMap;
import java.util.Map;
import com.beyond.constant.ApplicationConstant;

/**
 * The father class for all Controller
 * 
 * @author wangchao
 *
 */
public class BaseController {
	
		/**
		 * 获取成功消息后，需要打印的信息
		 *
		 * @return Map<String, Object>
		 */
		protected Map<String, Object> getSuccessResult()
		{
			Map<String, Object> resultMap = new HashMap<String, Object>();
			
			resultMap.put(ApplicationConstant.RETURN_KEY, ApplicationConstant.RESULT_SUCCESS);
			
			resultMap.put(ApplicationConstant.RETURN_MESSAGE, "");
			
			return resultMap;
		}

		/**
		 * 获取成功消息
		 * 
		 * @return Map<String, Object>
		 */
		protected Map<String, Object> getSuccessResult(String msg) {
			
			Map<String, Object> resultMap = new HashMap<String, Object>();
			
			resultMap.put(ApplicationConstant.RETURN_KEY,ApplicationConstant.RESULT_SUCCESS);
			
			resultMap.put(ApplicationConstant.RETURN_MESSAGE, msg);
			
			return resultMap;
		}

		
		/**
		 * 获取失败的消息
		 * 
		 * @param errMsg
		 *            失败提示信息
		 * @return Map<String, Object>
		 */
		protected Map<String, Object> getErrorResult(String errMsg) {
			
			Map<String, Object> resultMap = new HashMap<String, Object>();
			
			resultMap.put(ApplicationConstant.RETURN_KEY, ApplicationConstant.RESULT_FALTURE);
			
			resultMap.put(ApplicationConstant.RETURN_MESSAGE,errMsg);
			
			return resultMap;
		}


	

}
